<template>
    <div>
        <div class="dabg">
            <div class="gebgh">
                <div>
                    <h2><span class="hbnh" @click="$router.go(-1)"><a class="fan"></a></span> 每日涨停 <a class="shaux" @click="stockgetztb"></a>
                    </h2>
                </div>
            </div>
            <div class="boxkl">
                <ul class="ulkm" style="display: block !important; margin-top: 0px !important;">
                    <li v-for="(item,index) in zhangtingList" :key="index">
                        <div class="pkl">
                            <p>股票名称：<span>{{item.n}}</span></p>
                            <p>股票代码：<span>{{item.c}}</span></p>
                        </div>
                        <p class="dangeh"> 换手率（%）： <span class="heihk">{{(item.hs ? item.hs.toFixed(2) : 0.00)+'%'}}</span></p>
                        <p class="dangeh"> 涨跌幅： <span>{{(item.zdp ? item.zdp.toFixed(2) : 0.00)+'%'}}</span></p>
                        <p class="dangeh"> 最新价：<span>{{(item.p / 1000).toFixed(2)}}</span></p>
                        <p class="dangeh"> 成交额：<span>{{item.amount | toWanYi}}</span></p>
                        <p class="dangeh"> 流通市值： <span>{{item.fund | toWanYi}}</span></p>
                        <p class="dangeh">总市值：<span>{{item.tshare | toWanYi}} </span></p>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</template>
<script>
import { Toast } from 'vant';
import { MessageBox } from 'mint-ui'
import * as api from '@/axios/api'
export default {
    props: {},
    data() {
        return {
            zhangtingList: [],
        }
    },
    mounted() {
        this.stockgetztb()
    },
    filters: {
        // 数字转万亿
        toWanYi(num) {
            if (num > 1000000000000) {
                return (num / 1000000000000).toFixed(2) + '万亿'
            } else if (num > 100000000) {
                return (num / 100000000).toFixed(2) + '亿'
            } else if (num > 10000) {
                return (num / 10000).toFixed(2) + '万'
            } if (num < -1000000000000) {
                return (num / 1000000000000).toFixed(2) + '万亿'
            } else if (num < -100000000) {
                return (num / 100000000).toFixed(2) + '亿'
            } else if (num < -10000) {
                return (num / 10000).toFixed(2) + '万'
            } else {
                return num
            }
        }
    },
    methods: {
        async stockgetztb() {
            var opt = {}
            let data = await api.stockgetztb(opt)
            if (data.status === 0) {
                this.zhangtingList = data.data
            } else {
                Toast(data.msg)
            }
        },
    }
}
</script>
<style lang="less" scoped>
.dabg {
    background: #fff;

    .gebgh {
        height: 2.4rem;
        background: #F0F0F0;

        h2 {
            text-align: center;
            height: 1.25rem;
            width: 100%;
            position: relative;
            line-height: 1.25rem;
            font-size: .48rem;
            color: black;
            background: transparent;
            font-weight: 500;
            z-index: 3;

            .hbnh {
                position: absolute;
                left: 0.4rem;
                font-size: .43rem;
                font-weight: 500;

                .fan {
                    width: 0.5rem;
                    height: 0.5rem;
                    background: url() no-repeat 50%;
                    background-size: 100%;
                    display: inline-block;
                    margin-right: 0.13rem;
                    vertical-align: middle;
                    margin-top: -0.05rem;
                }
            }

            .shaux {
                position: absolute;
                width: 0.48rem;
                height: 0.48rem;
                background: url(~@/assets/img/icon_change.png) no-repeat 50%;
                background-size: 100%;
                right: 0.4rem;
                top: 0.4rem;
            }
        }
    }

    .boxkl {
        width: 100%;
        border-radius: 0.4rem 0.4rem 0 0;
        margin-top: -0.8rem;
        background: #fff;
        padding-top: 0.4rem;
        min-height: 1.07rem;

        .ulkm {
            li {
                width: 9.37rem;
                padding: 0.4rem 0;
                background: #ebe4fa;
                border-radius: 0.13rem;
                margin: 0 auto;
                margin-bottom: 0.266rem;

                .pkl {
                    width: 8.84rem;
                    margin: 0 auto;
                    display: flex;
                    justify-content: space-between;

                    p {
                        color: #1a1a1a;
                        font-size: .35rem;
                        width: 4rem;

                        span {
                            color: #5d7dfb;
                        }
                    }
                }

                .dangeh {
                    width: 8.84rem;
                    margin: 0 auto;
                    margin-top: 0.266rem;
                    font-size: .35rem;
                    color: #1a1a1a;
                    display: flex;

                    span {
                        color: #5d7dfb;
                    }
                }
            }
        }
    }
}
</style>